<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" >
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0">
    <title>幼儿园管理系统</title>
    <link rel="stylesheet" th:href="@{/res/layui/css/layui.css}">
    <link rel="stylesheet" th:href="@{/res/static/css/index.css}">
    <link rel="stylesheet" type="text/css" th:href="@{/css/bootstrap.min.css}">
</head>
<body>
<div class="main-product layui-row layui-col-space5">
    <div class="layui-col-md6" >
        <div class="layui-collapse">
            <div class="layui-colla-item">
                <h2 class="layui-colla-title">幼儿园资讯
                </h2>
                <div class="layui-colla-content layui-show" id="message"></div>
            </div>
        </div>
    </div>
    <div class="layui-col-md6" >
        <div class="layui-collapse">
            <div class="layui-colla-item">
                <h2 class="layui-colla-title">家长意见
                </h2>
                <div class="layui-colla-content layui-show" id="advice"></div>
            </div>
        </div>
    </div>

</div>

<script th:src="@{/res/layui/layui.js}"></script>
<script type="text/javascript" th:src="@{/js/jquery.min.js}"></script>
<script type="text/javascript" th:src="@{/plugin/easyui/jquery.easyui.min.js}"></script>
<script th:inline="javascript">
    $(function () {
        getAdviceOrMassage();

    });
    layui.config({
        base: '../res/static/js/'
    }).use('firm');

    /**
     * 获取家长意见或校园资讯
     */
    function getAdviceOrMassage() {
        $.post("/app/getAllService", function (data) {
            if (data.msg == 200) {
                for (var i = 0; i < data.adviceList.length; i++) {
                    if(data.adviceList[i].type === 3){
                        $("#message").append(" <ul class=\"layui-timeline\">\n" +
                            "            <li class=\"layui-timeline-item\">\n" +
                            "                <i class=\"layui-icon layui-timeline-axis\">&#xe63f;</i>\n" +
                            "                <div class=\"layui-timeline-content layui-text\">\n" +
                            "                    <h3 class=\"layui-timeline-title\">" + data.adviceList[i].date + "</h3>\n" +
                            "                    <ul>\n" +
                            "                        <li>" + data.adviceList[i].uname + "</li>\n" +
                            "                    </ul>\n" +
                            "                    <p>" + data.adviceList[i].adviceInfo + "</p>\n" +
                            "                </div>\n" +
                            "            </li>\n" +
                            "        </ul>");
                    }else {
                        $("#advice").append(" <ul class=\"layui-timeline\">\n" +
                            "            <li class=\"layui-timeline-item\">\n" +
                            "                <i class=\"layui-icon layui-timeline-axis\">&#xe63f;</i>\n" +
                            "                <div class=\"layui-timeline-content layui-text\">\n" +
                            "                    <h3 class=\"layui-timeline-title\">" + data.adviceList[i].date + "</h3>\n" +
                            "                    <ul>\n" +
                            "                        <li>" + data.adviceList[i].uname + "</li>\n" +
                            "                    </ul>\n" +
                            "                    <p>" + data.adviceList[i].adviceInfo + "</p>\n" +
                            "                </div>\n" +
                            "            </li>\n" +
                            "        </ul>");
                    }

                }
            } else {
                layer.msg(data.msg);
            }

        }, "json");
    }

</script>
</body>
</html>